//
//  UIViewController+Navigation.h
//  VIVideoPlayer
//
//  Created by MN on 2022/6/28.
//

#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN

@interface UIViewController (Navigation)

typedef NS_ENUM(NSInteger, VIAction) {
    VIActionLeft,//导航左边的按钮事件
    VIActionCenter,//中间标题的事件
    VIActionRight,//导航右边的按钮事件
};

/// 导航背景view
@property(nonatomic,strong) UIView *vi_navView;

/// 导航标题
@property(nonatomic,strong) UILabel *vi_titleLabel;

/// 导航左边按钮
@property(nonatomic,strong) UIButton *vi_leftBtn;

///导航右边按钮
@property(nonatomic,strong) UIButton *vi_rightBtn;

///导航右边按钮
@property(nonatomic,copy) void(^vi_actionBlock)(VIAction action);

///导航右边按钮
@property(nonatomic,copy) void(^vi_rightActionBlock)(void);

/// 更新导航标题
/// @param title 标题
- (void)vi_updateTitle:(NSString *)title;

/// 设置导航左边的图片
/// @param image 图片
- (void)vi_setLeftWithImage:(UIImage *)image;

/// 设置导航右边的文字
/// @param title 文字
- (void)vi_setRightWithTitle:(NSString *)title;

/// 设置导航右边的图片
/// @param image 图片
- (void)vi_setRightWithImage:(UIImage *)image;

/// 更新导航样式
/// @param backgroundColor 导航背景颜色
/// @param textColor 导航标题颜色
/// @param leftImage 导航左边图片
/// @param rightImage 导航右边图片
- (void)vi_updateBackgroundColor:(UIColor *)backgroundColor
                       textColor:(UIColor *)textColor
                       leftImage:(UIImage *)leftImage
                      rightImage:(UIImage *)rightImage;


/// 导航返回指定名字的页面 成功返回返回YES 否则 返回NO
/// @param name controller name
- (BOOL)vi_backControllerWithName:(NSString *)name;


/// 导航返回指定名字的页面 找不到页面回到跟页面
/// @param name controller name
- (void)vi_backControllerOrRootWithName:(NSString *)name;
@end

NS_ASSUME_NONNULL_END
